import json
import requests
from fake_useragent import UserAgent
import urllib3

# 禁用安全警告
requests.packages.urllib3.disable_warnings()
headers = {
    'User-Agent': UserAgent().chrome
}
# 定义请求url
url = "https://movie.douban.com/j/search_subjects"

params = {
    "type": "movie",  # movie电影 tv电视剧
    "tag": "最新",  # 中文标签，热门或者其余等等
    "page_limit": "4",  # 每一页拿多少个电影,可以有50
    "page_start": 0  # 开始第几页
}

r = requests.get(url=url, headers=headers, params=params, verify=False)
content = r.content
# 转换成字符串
string = content.decode('utf-8')
# 把字符串转成python数据类型
results = json.loads(string)
# print(results)
for item in results['subjects']:
    print(item['title'])
